package sfin.controller;

import java.io.Serializable;

import org.springframework.stereotype.Component;

import sfin.service.CategoriaService;
import sfin.service.LancamentoService;
import br.com.statizo.financeiro.domain.enums.GrupoLancamento;
@Component(value="estatController")
public class EstatisticaController implements Serializable{

	private static final long serialVersionUID = 1L;
	
	private int selectedIndex;
	private String[] categorias;
	private CategoriaService service;
	private LancamentoService lancamentoService;
	
	public EstatisticaController() {

	}
	
	public EstatisticaController(CategoriaService categoriaService, LancamentoService lancamentoService) {
		this.service = categoriaService;
		this.lancamentoService = lancamentoService;
		loadData();
	}
	
	private void loadData() {
		this.categorias = service.getAllNames();
	}

	public void setSelectedIndex(int selectedIndex) {
		this.selectedIndex = selectedIndex;
	}
	
	public int getSelectedIndex() {
		return selectedIndex;
	}

	public String[] getCategorias() {
		return categorias;
	}
	
	
	public Double getTotal(){
		return lancamentoService.getMontante(1, 2015, GrupoLancamento.DESPESA_ADICIONAL);
	}
	
}
